
import java.awt.BasicStroke;
import java.awt.Color;
import java.awt.Component;
import java.awt.GradientPaint;
import java.awt.Graphics;
import java.awt.Graphics2D;
import java.awt.Point;
import java.awt.Rectangle;
import java.awt.TexturePaint;
import java.awt.Transparency;
import java.awt.event.WindowStateListener;
import java.awt.geom.GeneralPath;
import java.awt.geom.RoundRectangle2D;
import java.awt.image.BufferedImage;
import java.util.ArrayList;
import javax.swing.JButton;
import javax.swing.JColorChooser;
import javax.swing.JFrame;
import javax.swing.JPanel;

public class Celulas extends javax.swing.JFrame {

    int ancho = 100;
    Color color = Color.GRAY;
    GeneralPath[] formas = new GeneralPath[4];
    int relleno = 0;
    int enlace = 0;
    Point p1 = new Point();
    Point p2 = new Point();
    Point pf = new Point();
    Point ini = new Point();
    Point auxelastica = new Point();
    Point auxinipath = new Point();
    boolean moviendo;
    int punto_mover = 5;
    GeneralPath path1;
    //= new GeneralPath();
    GeneralPath aux = new GeneralPath();
    ArrayList<curves> free_form = new ArrayList<curves>();
    boolean guardarActivo;

    /*
     @Override
     public synchronized void addWindowStateListener(WindowStateListener l) {
     super.addWindowStateListener(l);
     }

     @Override
     public Component add(Component comp) {
     return super.add(comp);
     }
     */
    public Celulas() {
        initComponents();


        this.setSize(950, 700);


        GeneralPath path1 = new GeneralPath();





// FORMA CILIADA  
        path1.moveTo(150, 290);
        path1.quadTo(160, 240, 125, 240);
        path1.quadTo(75, 225, 60, 170);
        path1.quadTo(65, 140, 110, 140);
        path1.quadTo(140, 125, 90, 80);
        path1.quadTo(80, 90, 60, 125);
        path1.quadTo(75, 60, 100, 60);
        path1.quadTo(140, 80, 130, 130);
        path1.quadTo(60, 180, 140, 210);
        path1.quadTo(180, 225, 150, 290);

        formas[0] = path1;
        path1 = new GeneralPath();



// FORMA ALARGADA
        path1.moveTo(180, 125);
        path1.quadTo(130, 75, 90, 125);//forma arco superior
        path1.lineTo(90, 325);//linea vertical
        path1.quadTo(130, 375, 180, 325);//forma el arco inferior
        path1.lineTo(180, 125);//2da linea vertical
        path1.lineTo(90, 125);//x y

        path1.lineTo(180, 125);//Creacion de anillos
        path1.moveTo(90, 160);
        path1.lineTo(180, 160);
        path1.moveTo(90, 215);
        path1.lineTo(180, 215);
        path1.moveTo(90, 270);
        path1.lineTo(180, 270);
        path1.moveTo(91, 328);
        path1.lineTo(180, 328);
        path1.moveTo(93, 120);
        path1.lineTo(178, 120);
        formas[1] = path1;
        path1 = new GeneralPath();







        // FORMA ESTRELLADA     
        path1.moveTo(40, 260);

        path1.quadTo(125, 210, 40, 170);
        path1.quadTo(110, 160, 80, 90);
        path1.quadTo(140, 130, 185, 60);
        path1.quadTo(175, 150, 240, 135);
        path1.quadTo(190, 220, 260, 210);
        path1.quadTo(160, 220, 190, 280);
        path1.quadTo(130, 210, 40, 260);
        // path1.quadTo(180,260, 60, 240);
        formas[2] = path1;
        path1 = new GeneralPath();

        //FORMA CILINDRICA
        path1.moveTo(100, 125);
        path1.quadTo(75, 100, 100, 75);
        path1.lineTo(275, 75);
        path1.quadTo(300, 100, 275, 125);
        path1.lineTo(100, 125);
        formas[3] = path1;
        path1 = new GeneralPath();

        /*
         g2.drawOval(100, 200, 10, 10);
         path1.curveTo(150, 100,450,100,500,200);//x1,y1,x2,y2,x3,y3
         g2.drawOval(150, 100, 10, 10);
         g2.drawOval(250, 100, 10, 10);
         g2.drawOval(300, 200, 10, 10);
         gp7.moveTo(500, 200);
         gp7.curveTo(450, 300,150,300,100,200);
 
 
  
         g2.draw(path1);
         g2.draw(gp7);
    
         g2.drawOval(250, 250, 10, 10);*/
        //gp7.moveTo(150.0f,150.0f);
        //gp7.quadTo(100.0f,200, 200,270);
        //gp6.moveTo(150.0f,200.0f);
        //gp6.quadTo(200,120, 330,270.0f);


        //dibujamos


        //g2.draw(gp6);

        //g2.draw(path1);





    }

    public void paint(Graphics g) {
        super.paintComponents(g);//llamada al constructor de la clase padre

        Graphics2D g2 = (Graphics2D) g;//con esto vamos a dibujar 


        g2.translate(0, 150);
        g2.drawLine(0, 0, 1000, 0);


//Estilos de relleno
        if (jComboBox3.getSelectedIndex() == 0) {
            g2.setStroke(new BasicStroke(1));//dibuja de forma continua con grosor de linea de 1 pixel
        } else {
            float guiones[] = {10};
            g2.setStroke(new BasicStroke(2, BasicStroke.CAP_ROUND,//forma punteada con lineas de 10 pixeles
                    BasicStroke.JOIN_ROUND, 10, guiones, 0));
        }

        g2.setPaint(color);
        switch (jComboBox2.getSelectedIndex()) {
            case 0:
                g2.draw(formas[enlace]);
                break;
            case 1:
                g2.fill(formas[enlace]);
                break;
            case 2:
                g2.setPaint(new GradientPaint(5, 30, color, 35, 100, Color.black, true));
                g2.fill(formas[enlace]);

                break;

            case 3:


                BufferedImage imagenBuf = new BufferedImage(10, 10, BufferedImage.TYPE_INT_RGB);


                Graphics2D low = imagenBuf.createGraphics();
                low.setColor(color.RED);
                low.fillRect(0, 0, 10, 10);
                low.setColor(color.BLACK);
                low.drawRect(1, 1, 6, 6);
                low.setColor(color.BLUE);
                low.fillRect(1, 1, 3, 3);
                low.setColor(Color.BLACK);
                low.fillRect(4, 4, 3, 3);
                g2.setPaint(new TexturePaint(imagenBuf, new Rectangle(10, 10)));
                g2.fill(formas[enlace]);

                break;
        }



        //Empezamos a dibujar desde manual 


        aux = new GeneralPath();



        g2.setColor(color);
        if (path1 != null) {
            g2.draw(path1);
        }




        if (auxelastica.x > 0 && pf.x == 0 && ini.x > 0) {
            g2.drawLine(ini.x, ini.y, auxelastica.x, auxelastica.y);
        }

        if (ini.x > 0 && ini.y > 0 && pf.x > 0) {
            aux.moveTo(ini.x, ini.y);
            aux.curveTo(p1.x, p1.y, p2.x, p2.y, pf.x, pf.y);
            g2.draw(aux);
        }

        g2.setPaint(Color.red);
        //g2.drawOval(pf.x-5, pf.y-5, 10, 10);

        g2.fillOval(pf.x - 5, pf.y - 5, 10, 10);
        g2.fillOval(p1.x - 5, p1.y - 5, 10, 10);
        g2.fillOval(p2.x - 5, p2.y - 5, 10, 10);
        g2.fillOval(ini.x - 5, ini.y - 5, 10, 10);



        g2.setPaint(color);

        GuardaCurva(path1, g2);

        for (int i = 0; i < free_form.size(); i++) {
            g2.setPaint(free_form.get(i).contextoPaint);


            if (free_form.get(i).tipolinea == 0) {
                g2.setStroke(new BasicStroke(1));//dibuja de forma continua con grosor de linea de 1 pixel
            } else {
                float guiones[] = {10};
                g2.setStroke(new BasicStroke(2, BasicStroke.CAP_ROUND,//forma punteada con lineas de 10 pixeles
                        BasicStroke.JOIN_ROUND, 10, guiones, 0));
            }

            //g2=contexto.get(i);

            switch (free_form.get(i).indicepaint) {
                case 0:
                    g2.draw(free_form.get(i).Curvapath1);
                    break;
                case 1:
                    g2.fill(free_form.get(i).Curvapath1);
                    break;
                case 2:
                    g2.setPaint(new GradientPaint(5, 30, color, 35, 100, Color.black, true));
                    g2.fill(free_form.get(i).Curvapath1);

                    break;

                case 3:


                    BufferedImage imagenBuf = new BufferedImage(10, 10, BufferedImage.TYPE_INT_RGB);


                    Graphics2D low = imagenBuf.createGraphics();
                    low.setColor(color.RED);
                    low.fillRect(0, 0, 10, 10);
                    low.setColor(color.BLACK);
                    low.drawRect(1, 1, 6, 6);
                    low.setColor(color.BLUE);
                    low.fillRect(1, 1, 3, 3);
                    low.setColor(Color.BLACK);
                    low.fillRect(4, 4, 3, 3);
                    g2.setPaint(new TexturePaint(imagenBuf, new Rectangle(10, 10)));
                    g2.fill(free_form.get(i).Curvapath1);

                    break;
            }






            //  g2.draw(free_form.get(i).Curvapath1);

        }




    }

    @SuppressWarnings("unchecked")
    // <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
    private void initComponents() {

        jComboBox1 = new javax.swing.JComboBox();
        jButton1 = new javax.swing.JButton();
        jComboBox2 = new javax.swing.JComboBox();
        jComboBox3 = new javax.swing.JComboBox();
        jButton2 = new javax.swing.JButton();
        jButton3 = new javax.swing.JButton();
        jButton4 = new javax.swing.JButton();

        setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE);
        addMouseListener(new java.awt.event.MouseAdapter() {
            public void mouseClicked(java.awt.event.MouseEvent evt) {
                formMouseClicked(evt);
            }
            public void mousePressed(java.awt.event.MouseEvent evt) {
                formMousePressed(evt);
            }
            public void mouseReleased(java.awt.event.MouseEvent evt) {
                formMouseReleased(evt);
            }
        });
        addMouseMotionListener(new java.awt.event.MouseMotionAdapter() {
            public void mouseDragged(java.awt.event.MouseEvent evt) {
                formMouseDragged(evt);
            }
            public void mouseMoved(java.awt.event.MouseEvent evt) {
                formMouseMoved(evt);
            }
        });

        jComboBox1.setModel(new javax.swing.DefaultComboBoxModel(new String[] { "CILIADA", "ALARGADA", "ESTRELLADA", "CILÍNDRICAS" }));
        jComboBox1.setBorder(javax.swing.BorderFactory.createEmptyBorder(3, 3, 3, 3));
        jComboBox1.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jComboBox1ActionPerformed(evt);
            }
        });

        jButton1.setText("COLOR");
        jButton1.addMouseListener(new java.awt.event.MouseAdapter() {
            public void mouseClicked(java.awt.event.MouseEvent evt) {
                jButton1MouseClicked(evt);
            }
        });
        jButton1.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jButton1ActionPerformed(evt);
            }
        });

        jComboBox2.setModel(new javax.swing.DefaultComboBoxModel(new String[] { "Sin relleno", "Solido", "degradado", "textura" }));
        jComboBox2.addMouseListener(new java.awt.event.MouseAdapter() {
            public void mouseClicked(java.awt.event.MouseEvent evt) {
                jComboBox2MouseClicked(evt);
            }
        });
        jComboBox2.addItemListener(new java.awt.event.ItemListener() {
            public void itemStateChanged(java.awt.event.ItemEvent evt) {
                jComboBox2ItemStateChanged(evt);
            }
        });

        jComboBox3.setForeground(new java.awt.Color(255, 51, 51));
        jComboBox3.setModel(new javax.swing.DefaultComboBoxModel(new String[] { "Linea Continua", "Linea Punteada" }));
        jComboBox3.setBorder(javax.swing.BorderFactory.createMatteBorder(2, 2, 2, 2, new java.awt.Color(204, 0, 204)));
        jComboBox3.addItemListener(new java.awt.event.ItemListener() {
            public void itemStateChanged(java.awt.event.ItemEvent evt) {
                jComboBox3ItemStateChanged(evt);
            }
        });
        jComboBox3.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jComboBox3ActionPerformed(evt);
            }
        });

        jButton2.setText("Guardar Figura");
        jButton2.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jButton2ActionPerformed(evt);
            }
        });

        jButton3.setText("Coordenadas");
        jButton3.addMouseListener(new java.awt.event.MouseAdapter() {
            public void mouseClicked(java.awt.event.MouseEvent evt) {
                jButton3MouseClicked(evt);
            }
        });
        jButton3.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jButton3ActionPerformed(evt);
            }
        });

        jButton4.setText("Limpiar Pantalla");
        jButton4.addMouseListener(new java.awt.event.MouseAdapter() {
            public void mouseClicked(java.awt.event.MouseEvent evt) {
                jButton4MouseClicked(evt);
            }
        });
        jButton4.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jButton4ActionPerformed(evt);
            }
        });

        javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane());
        getContentPane().setLayout(layout);
        layout.setHorizontalGroup(
            layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(layout.createSequentialGroup()
                .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                .addComponent(jComboBox3, javax.swing.GroupLayout.PREFERRED_SIZE, 103, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addComponent(jComboBox1, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addGap(18, 18, 18)
                .addComponent(jComboBox2, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addGap(18, 18, 18)
                .addComponent(jButton1)
                .addGap(18, 18, 18)
                .addComponent(jButton2)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addComponent(jButton4)
                .addGap(62, 62, 62)
                .addComponent(jButton3)
                .addGap(107, 107, 107))
        );
        layout.setVerticalGroup(
            layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(layout.createSequentialGroup()
                .addContainerGap()
                .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false)
                    .addComponent(jComboBox3)
                    .addGroup(layout.createSequentialGroup()
                        .addGap(1, 1, 1)
                        .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                            .addComponent(jComboBox1)
                            .addComponent(jComboBox2)))
                    .addComponent(jButton1, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                    .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                        .addComponent(jButton2, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                        .addComponent(jButton4, javax.swing.GroupLayout.PREFERRED_SIZE, 31, javax.swing.GroupLayout.PREFERRED_SIZE)
                        .addComponent(jButton3, javax.swing.GroupLayout.PREFERRED_SIZE, 31, javax.swing.GroupLayout.PREFERRED_SIZE)))
                .addContainerGap(377, Short.MAX_VALUE))
        );

        pack();
    }// </editor-fold>//GEN-END:initComponents

    private void jComboBox1ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jComboBox1ActionPerformed
        // TODO add your handling code here:
        enlace = jComboBox1.getSelectedIndex();
        repaint();
    }//GEN-LAST:event_jComboBox1ActionPerformed

    private void jButton1ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton1ActionPerformed
        // TODO add your handling code here: 
    }//GEN-LAST:event_jButton1ActionPerformed

    private void jButton1MouseClicked(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_jButton1MouseClicked
        // TODO add your handling code here:
        color = JColorChooser.showDialog(
                Celulas.this, "Seleccione un color", color);

        // establece el color predeterminado, si no se devuelve un color
        if (color == null) {
            color = Color.LIGHT_GRAY;
        }
        repaint();

    }//GEN-LAST:event_jButton1MouseClicked

    private void jComboBox2MouseClicked(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_jComboBox2MouseClicked
        // TODO add your handling code here:
        relleno = jComboBox2.getSelectedIndex();

        repaint();
    }//GEN-LAST:event_jComboBox2MouseClicked

    private void jComboBox2ItemStateChanged(java.awt.event.ItemEvent evt) {//GEN-FIRST:event_jComboBox2ItemStateChanged
        // TODO add your handling code here:

        repaint();
    }//GEN-LAST:event_jComboBox2ItemStateChanged

    private void jComboBox3ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jComboBox3ActionPerformed
        // TODO add your handling code here:
    }//GEN-LAST:event_jComboBox3ActionPerformed

    private void jComboBox3ItemStateChanged(java.awt.event.ItemEvent evt) {//GEN-FIRST:event_jComboBox3ItemStateChanged
        // TODO add your handling code here:
        repaint();
    }//GEN-LAST:event_jComboBox3ItemStateChanged

    private void formMouseClicked(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_formMouseClicked
        // TODO add your handling code here:

        //path1.append(path1 , moviendo);
        //se ejecuta cuando el punto de inicio es mayor que cero y tambien cuando la coordenada de x del punto final =0
        Point pmouse = new Point(evt.getX(), evt.getY() - 150);

        if (ini.x > 0 && pf.x > 0) {
            if (pmouse.getX() > pf.x - 5 && pmouse.getX() < pf.x + 5 && pmouse.getY()
                    > pf.y - 5 && pmouse.getY() < pf.y + 5) {


                //System.out.println("size: "+free_form.size()+"O: "+path1);
                //path1.moveTo(auxinipath.x, auxinipath.y);
                path1.curveTo(p1.x, p1.y, p2.x, p2.y, pf.x, pf.y);

                ini.setLocation(pf.x, pf.y);
                pf.setLocation(0, 0);
                p1.setLocation(0, 0);
                p2.setLocation(0, 0);

            }
        } else if (ini.x > 0 && pf.x == 0) {
            pf.move((int) pmouse.getX(), (int) pmouse.getY());
            p1.x = (int) ((ini.x + ((0.5) * pf.x)) / (1.5));
            p1.y = (int) ((ini.y + ((0.5) * pf.y)) / (1.5));
            p2.x = (int) (ini.x + (2) * pf.x) / (3);
            p2.y = (int) (ini.y + (2) * pf.y) / (3);




            //if(ini.x>0 && pf.x>0)


        }

        // se ejecuta cuando se indica el punto inicial que es igual con 0.
        if (ini.x == 0 && ini.y == 0) {
            path1 = new GeneralPath();
            ini.move((int) pmouse.getX(), (int) pmouse.getY());
            auxinipath.move((int) pmouse.getX(), (int) pmouse.getY());
            path1.moveTo((int) pmouse.getX(), (int) pmouse.getY());


        }
        repaint();
    }//GEN-LAST:event_formMouseClicked

    public void GuardaCurva(GeneralPath trazo, Graphics2D contextografic) {
        if (guardarActivo) {

            curves construye = new curves(trazo, contextografic, jComboBox2.getSelectedIndex(), jComboBox3.getSelectedIndex());
            free_form.add(construye);

            System.out.println("relleno: " + jComboBox2.getSelectedIndex() + " estilo: " + jComboBox3.getSelectedIndex());

            // path1 = new GeneralPath();
            ini.setLocation(0, 0);
            pf.setLocation(0, 0);
            p1.setLocation(0, 0);
            p2.setLocation(0, 0);
            path1.closePath();


            trazo = null;

            guardarActivo = false;
        }



    }
    private void formMouseDragged(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_formMouseDragged
        // TODO add your handling code here:
        Point pmouse = new Point(evt.getX(), evt.getY() - 150);

        if (moviendo) {
            switch (punto_mover) {
                case 0:
                    //se actualiza el punto final
                    pf.x = (int) pmouse.getX();
                    pf.y = (int) pmouse.getY();

                    break;
// punto inetermedio se actualiza
                case 1:
                    p1.x = (int) pmouse.getX();
                    p1.y = (int) pmouse.getY();

                    break;

                case 2:
                    p2.x = (int) pmouse.getX();
                    p2.y = (int) pmouse.getY();

                    break;

                case 3:
                    ini.x = (int) pmouse.getX();
                    ini.y = (int) pmouse.getY();

                    break;

                default:
                    break;
            }

            repaint();


        }
    }//GEN-LAST:event_formMouseDragged

    private void formMouseReleased(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_formMouseReleased
        // TODO add your handling code here:
        moviendo = false;
    }//GEN-LAST:event_formMouseReleased

    private void formMousePressed(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_formMousePressed
        // TODO add your handling code here:
        // del evento donde esta el mouse si es mayor restando -5 entra 
        Point pmouse = new Point(evt.getX(), evt.getY() - 150);





        if (pmouse.getX() > pf.x - 5 && pmouse.getX() < pf.x + 5 && pmouse.getY() > pf.y - 5 && pmouse.getY() < pf.y + 5) {
            punto_mover = 0;
            moviendo = true;// para no mandar a  llamar a repaint cuando no sea necesario.

        }

        if (pmouse.getX() > p1.x - 5 && pmouse.getX() < p1.x + 5 && pmouse.getY() > p1.y - 5 && pmouse.getY() < p1.y + 5) {
            punto_mover = 1;
            moviendo = true;// para no mandar a  llamar a repaint cuando no sea necesario.

        }

        if (pmouse.getX() > p2.x - 5 && pmouse.getX() < p2.x + 5 && pmouse.getY() > p2.y - 5 && pmouse.getY() < p2.y + 5) {
            punto_mover = 2;
            moviendo = true;// para no mandar a  llamar a repaint cuando no sea necesario.

        }

        if (pmouse.getX() > ini.x - 5 && pmouse.getX() < ini.x + 5 && pmouse.getY() > ini.y - 5 && pmouse.getY() < ini.y + 5) {
            punto_mover = 3;
            moviendo = true;// para no mandar a  llamar a repaint cuando no sea necesario.

        }
    }//GEN-LAST:event_formMousePressed

    private void formMouseMoved(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_formMouseMoved
        // TODO add your handling code here:
        Point pmouse = new Point(evt.getX(), evt.getY() - 150);

        if (pf.x == 0 && ini.x > 0) {

            auxelastica.setLocation(pmouse.x, pmouse.y);
            repaint();

        }


    }//GEN-LAST:event_formMouseMoved

    private void jButton2ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton2ActionPerformed
        // TODO add your handling code here:


        guardarActivo = true;
        repaint();

    }//GEN-LAST:event_jButton2ActionPerformed

    private void jButton3MouseClicked(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_jButton3MouseClicked
        // TODO add your handling code here:
        path1 = new GeneralPath();
        Coordenadas vcoordenadas = new Coordenadas(this, this.path1);
        vcoordenadas.setSize(500, 500);
        vcoordenadas.setDefaultCloseOperation(JFrame.DISPOSE_ON_CLOSE);
        vcoordenadas.setVisible(true);
    }//GEN-LAST:event_jButton3MouseClicked

    private void jButton3ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton3ActionPerformed
        // TODO add your handling code here:
    }//GEN-LAST:event_jButton3ActionPerformed

    private void jButton4MouseClicked(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_jButton4MouseClicked
        // TODO add your handling code here:
        Point p1 = null;
        Point p2 = null;
        Point pf = null;
        Point ini = null;
        Point auxelastica =null;
    Point auxinipath = null;
   // boolean moviendo;
    //int punto_mover = 5;
    GeneralPath path1=null;
    //= new GeneralPath();
    GeneralPath aux = null;
    ArrayList<curves> free_form = null;
   // boolean guardarActivo;

         

    }//GEN-LAST:event_jButton4MouseClicked

    private void jButton4ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton4ActionPerformed
        // TODO add your handling code here:
    }//GEN-LAST:event_jButton4ActionPerformed

    /**
     * @param args the command line arguments
     */
    public static void main(String args[]) {
        /* Set the Nimbus look and feel */
        //<editor-fold defaultstate="collapsed" desc=" Look and feel setting code (optional) ">
        /* If Nimbus (introduced in Java SE 6) is not available, stay with the default look and feel.
         * For details see http://download.oracle.com/javase/tutorial/uiswing/lookandfeel/plaf.html 
         */
        try {
            for (javax.swing.UIManager.LookAndFeelInfo info : javax.swing.UIManager.getInstalledLookAndFeels()) {
                if ("Nimbus".equals(info.getName())) {
                    javax.swing.UIManager.setLookAndFeel(info.getClassName());
                    break;
                }
            }
        } catch (ClassNotFoundException ex) {
            java.util.logging.Logger.getLogger(Celulas.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
        } catch (InstantiationException ex) {
            java.util.logging.Logger.getLogger(Celulas.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
        } catch (IllegalAccessException ex) {
            java.util.logging.Logger.getLogger(Celulas.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
        } catch (javax.swing.UnsupportedLookAndFeelException ex) {
            java.util.logging.Logger.getLogger(Celulas.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
        }
        //</editor-fold>

        /* Create and display the form */


        java.awt.EventQueue.invokeLater(new Runnable() {
            public void run() {
                new Celulas().setVisible(true);
            }
        });






    }
    // Variables declaration - do not modify//GEN-BEGIN:variables
    private javax.swing.JButton jButton1;
    private javax.swing.JButton jButton2;
    private javax.swing.JButton jButton3;
    private javax.swing.JButton jButton4;
    private javax.swing.JComboBox jComboBox1;
    private javax.swing.JComboBox jComboBox2;
    private javax.swing.JComboBox jComboBox3;
    // End of variables declaration//GEN-END:variables
}
